/**
 * Created by jiangj01 on 15/12/05.
 */
define(function (require) {
    var util = require('static_public/js/util.js');

    describe('static_public/js/util', function () {
        it('getUrlPara', function () {
            var url = 'http://testwls.myscrm.com.cn/wls/index.html?token=mwfxhf1439956554&test=123';

            expect(util.getUrlPara('test', url)).toEqual('123');
            expect(util.getUrlPara('test1', url)).toEqual('');
        });

        it('getUrlObj', function () {
            var url = 'http://testwls.myscrm.com.cn:8080/wls/index.html?token=mwfxhf1439956554&test=123#1312313';

            expect(util.getUrlObj(url)).toEqual({
                protocol: 'http:',
                host: 'testwls.myscrm.com.cn:8080',
                hostname: 'testwls.myscrm.com.cn',
                search: 'token=mwfxhf1439956554&test=123',
                hash: '1312313',
                pathname: '/wls/index.html',
                port: '8080'
            });
        });

        it('getQueryParams', function () {
            var search = '?token=mwfxhf1439956554&test=123';

            expect(util.getQueryParams(search)).toEqual({
                token: 'mwfxhf1439956554',
                test: '123'
            });
        });

        it('setUrlPara', function () {
            var url = 'http://testwls.myscrm.com.cn:8080/wls/index.html?token=mwfxhf1439956554&test=123#1312313';

            expect(util.setUrlPara('test', '124', url)).toEqual('http://testwls.myscrm.com.cn:8080/wls/index.html?token=mwfxhf1439956554&test=124#1312313');
        });
    });
});